<template>
  <div>
    <el-button type="primary" size="mini" style="width: 60px;margin-left: 20px;margin-top: 20px" @click="closePage">返回
    </el-button>
    <div style="display: flex;justify-content: space-between;margin: 25px 100px 25px 50px">
      <div style="color: grey">
        学校名称：<span style="color: black">{{ schoolInfo.name }}</span>
      </div>
      <div style="color: grey">
        校园安全负责人：<span style="color: black">{{ schoolInfo.sysUser.nickName }}</span>
      </div>
      <div style="color: grey">
        电话：<span style="color: black">{{ schoolInfo.sysUser.phonenumber }}</span>
      </div>
      <div style="color: #409EFF;cursor: pointer" @click="handleJump()">
        行政人数：<span>{{ schoolInfo.staffNum }}</span>
      </div>
      <div style="color: #409EFF;cursor: pointer" @click="handleLine()">
        巡查路线数量：<span>{{ lineNum }}</span>
      </div>
    </div>
    <div style="height: 1px;background: #e6ebf5;margin-top: 10px">

    </div>
    <index :schoolId="schoolInfo.id"></index>
  </div>
</template>

<script>
import index from './index.vue'
import {listLineAll} from "@/api/patrol/line";

export default {
  name: "staff",
  components: {index},
  data() {
    return {
      schoolInfo: null,
      lineNum: 0
    }
  },
  created() {
    this.schoolInfo = this.$route.query.schoolInfo;
    listLineAll({"lineType": 1, "schoolId": this.schoolInfo.id}).then(response => {
      this.lineNum = response.data.length;
    })
  },
  methods: {
    //关闭页面
    closePage() {
      this.$store.dispatch('tagsView/delView', this.$route)
      // this.$router.go(-1)
      this.$tab.openPage("行政巡查", "/patrol/record_staff_district");
    },
    handleJump() {
      this.$router.push({
        path: '/district/staffCheck',
        query: {
          schoolId: this.schoolInfo.id
        }
      })
    },
    handleLine() {
      this.$router.push({
        path: '/district/line',
        query: {
          schoolInfo: this.schoolInfo,
          lineType: 1
        }
      })
    }
  }
};
</script>
